GRM-Datenübertragung

C max. 100 kHz (10 µs), Hi-Nadel 3 µs

                                                         16-Bit-Adresse                                                                   |     Target            Ergebnis
    _________________________________________________________________________________________________________________________________________________________________________
E__/                                                                                                                                      |                                  \_____
 _____ 13µs _  7µs _      _3µs   _      _      _      _      _    19µs   _      _      _      _      _      _      _      _           _   |    _      _   15µs   _              ___
C     \____/ \____/ \____/ \____/ \____/ \____/ \____/ \____/ \_________/ \____/ \____/ \____/ \____/ \____/ \____/ \____/ \_________/ \______/ \____/ \________/ \____________/
 ___       ______               ____________________                                  _____________        _____________             ________            _______     27µs     _____
D   \_____/      \_____________/                    \________________________________/             \______/             \___________/     |  \__________/       \____________/
                                                                                                                                          |
            1      0      0      1      1      1      0      0           0      0      1      1      0      1      1      0          P=0  |   W=0    M=0        A=0
           ____________________________________________________         ____________________________________________________              |
----------{___________9___________________________C____________}-------{___________3___________________________6____________}------------------------------------------------------
                                                                                                                                          |

So sieht das Signalbild bei „LoBat“ aus.

Gefundene Adressen
AdresseM
9C360LoBat
FFE0~FFFF1„Partitionstabelle“

Routinensammlung

Problem: I²C muss bitweise simuliert werden, sonst fehlt die Zeit. Dazu ist eine Bit-FIFO erforderlich. Diese ist hier LSBfirst dargestellt.

;Bitnummer in Bitmaske
	movlw	1
	btfsc	bitnr,1
	 movlw	4
	btfsc	bitnr,0
	 addwf	WREG,f
	btfsc	bitnr,2
	 swapf	WREG,f
;Bitmaske in 16-Bit-Wort setzen
	btfsc	bitnr,3
	 iorwf	bitbuf+1,f
	btfss	bitnr,3
	 iorwf	bitbuf+0,f
;Bitnummer erhöhen
	incf	bitnr,f

;Bit ausschieben (Carry-Flag) und Bitnummer erniedrigen
	lsrf	bitbuf+1,f
	rrf	bitbuf+0,f
	decf	bitnr,f

;Einfangen von Pegelwechseln in 8 Bit
	rlf	PORTA,w
	rlf	WREG,w
	andlw	0x30
	iorwf	PORTC,w	; beten dass Bit[7:6]=0 sind
	xorwf	pinstate,w	;w = Pegelwechsel
	xorwf	pinstate,f	;pinstate = (neuer) Zustand